package com.hx.learn.log.logback.mdc;

import com.hx.learn.log.logback.util.RequestFlow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;


/**
 * @author jxlgcmh
 * @date 2021-08-29 16:51
 * @description
 */
public class SimpleMDC {

    public static void main(String[] args) {
        // You can put values in the MDC at any time. Before anything else
        // we put the first name
        Logger logger = LoggerFactory.getLogger(SimpleMDC.class);
        // We now put the last name
        MDC.put("requestFlow", RequestFlow.getRandomFlowNo());

        // The most beautiful two words in the English language according
        // to Dorothy Parker:
        logger.info("Check enclosed.");
        logger.debug("The most beautiful two words in English.");
        MDC.put("requestFlow", RequestFlow.getRandomFlowNo());
        logger.info("I am not a crook.");
        logger.info("Attributed to the former US president. 17 Nov 1973.");
    }
}
